-
Notifications
You must be signed in to change notification settings - Fork 140
Fix block button text color setting not taking effect #895
Fix block button text color setting not taking effect #895
Conversation
…to master-2 # Conflicts: # assets/css/editor-style-block.css
Another solution is to get the editor styles changed. |
Maybe just strengthen the utility color classes in general. That's how core ended up dealing with it. Discussion on that decision and some other options are here: |
@m-e-h Thanks for the link, and the suggestion! Increasing the specificity of the color classes by prefixing them with |
…to fix/block-button-text-color
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
As described in #893, the button block text color setting isn't working with the editor palette classes. This PR fixes that issue.
The root of the problem is that the
.has-x-color
styling is being overwritten bycolor: inherit
being applied to the button element with higher specificity. In the theme, we can fix this by updating the targeting to:not(.has-text-color)
, which this PR does.However, the core block editor styles (output on the front-end) includes the following CSS:
Which also overwrites the
.has-x-color
class, applied to the.wp-block-button__link
element. I couldn't see any solution to this other than reapplying all of the.has-x-color
classes to this element specifically, with a specificity high enough that it overwrites thecolor: inherit
block above. So this PR adds the following:Along with corresponding updates to the targeting in
twentytwenty_get_elements_array
. This is an ugly solution, but I don't see another way of overruling thecolor: inherit
set in the core styles.Edit: Updated the solution per this suggestion by @m-e-h, which brings it more in line with how core handles the specificity of the color classes.
Fixes #893.